<script setup lang="ts">
import { ref, reactive, computed } from "vue";
// 单个
const dragEl = ref<HTMLElement | null>(null);

// 多个
const dragElT = ref({});
</script>


<template>
  <div>
    <!-- 单个 -->
    <div ref="dragEl" class="drag-box">drag</div>

    <!-- 多个 -->

    <div :ref="el => dragElT.el1 = el" class="drag-box">drag</div>
    <div :ref="el => dragElT.el2 = el" class="drag-box">drag</div>
    <div :ref="el => dragElT.el3 = el" class="drag-box">drag</div>
  </div>
</template>



<style>
.drag-box {
  width: 100px;
  height: 100px;
  background-color: red;
}
</style>
